/*
   exel 文件创建
*/
const wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };//这里的数据是用来定义导出的格式类型
function createExel(data, type) {
	var teamScoresList='Sheet1';
    const wb = { SheetNames: [teamScoresList], Sheets: {}, Props: {} };
    wb.Sheets[teamScoresList] = XLSX.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据
    
	saveAs(new Blob([s2ab(XLSX.write(wb, wopts))], 
	     { type: "application/octet-stream" }), 
		 type + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType));
		 
}

function s2ab(s) {
    if (typeof ArrayBuffer !== 'undefined') {
         var buf = new ArrayBuffer(s.length);
         var view = new Uint8Array(buf);
         for (var i = 0; i != s.length; ++i) 
		    view[i] = s.charCodeAt(i) & 0xFF;
         return buf;
    } 
	else
	{
         var buf = new Array(s.length);
         for (var i = 0; i != s.length; ++i) buf[i] = s.charCodeAt(i) & 0xFF;
         return buf;
    }
			
}

